Flash Article

Time Entry Application: Sample Workflow for Designing and Building Applications in Flash MX Professional 2004


Table of Contents

  1. Introduction
  2. Features of the Time Entry Application
  3. Installing the Time Entry Application
  4. Defining the Time Entry Application Framework

Features of the Time Entry Application

The Time Entry sample application (see Figure 1) demonstrates the following features:

  • Querying an Access database using a Cold Fusion web service
  • Creating calculated fields
  • Embedding a CheckBox within a DataGrid
  • Creating a static data-aware lookup list
  • Creating a dynamic data-aware lookup list
  • Filtering
  • Sorting
  • Creating an update log file (displays data sent between client and server)
  • Saving data and changes offline
  • Adding a reconcile dialog box (reports errors from the server and allows users to fix and resend)

Time Entry sample application and its features

Figure 1. Time Entry sample application and its features

Querying an Access database using a ColdFusion web service: Included with the installation is a sample ColdFusion component (CFC) that allows you easily to query an Access database that has been set up as a ColdFusion data source. The CFC also understands the format of the update packets sent from the RDBMSResolver. It parses the updates, generates the correct SQL statements, and creates a formatted result packet containing any errors or updates that occurred as a result of updating the Access database.

Note: You access the CFC from the sample application as a web service but you could easily switch that to work through Flash Remoting.

Creating calculated fields: The cost field that appears in the DataGrid component is a calculated field. If you modify the hours or the rate field, the cost field automatically updates. It is never included in the update packet because it only resides in memory within the application.

Embedding a CheckBox: The DataGrid component makes it easy to modify Boolean values by embedding a CheckBox within the Billable column. The source code (included with the example) shows how to create this setup.

Creating a static data-aware lookup list: The Services ComboBox contains a list of static values. Selecting a new value updates the selected time entry with a new foreign key value.

Creating a dynamic data-aware lookup list: The Projects ComboBox contains a list of dynamic values pulled from another table within the database. Selecting a new value updates the selected time entry with a new foreign key value.

Filtering: Users can filter records that appear within the DataGrid by changing the dates at the top of the screen.

Sorting: Users can sort data by clicking on any column header.

Creating an update log file: A log entry is generated every time data is saved. The log contains a copy of the update packet that was sent to the server and the result packet that was returned from the server. You can view the Update Log tab, which contains a view of all log entries, by selecting View > Update Log.

Saving data and changes offline: Users can work with data offline or online. Test this functionality as follows:

  1. Click the Load button to retrieve data from the server.
  2. Modify the data (adds, edits, deletes).
  3. Select Settings > Work Offline.
  4. Click the Save button. Your data is saved on your local machine (shared object).
  5. Select Settings > Work Offline again to uncheck the option.
  6. Click the Load button to retrieve data from the server. The data reflects what is on the server (the original data you pulled in Step 1 without your modifications).
  7. Select Settings > Work Offline.
  8. Click the Load button to retrieve data from your local machine (shared object). The data now reflects the changes you made in Step 2.
  9. Select Settings > Work Offline again to uncheck the option.
  10. Click Save to send your updates back to the server.

As you can see, you can work completely disconnected from the server. The DataSet tracks all your changes and continues updating the DeltaPacket. When you are back online the DeltaPacket is sent to the server for processing.

Adding a reconcile dialog box: The reconcile dialog box appears automatically whenever an error (or more than one) is returned from the server as a result of saving data. The dialog box displays the error message from the server and provides you with several options:

  • Discard This Change: When you close the dialog box the changed record reverts to its original state and the update instruction is removed from the DeltaPacket. The following rules apply when you revert a record to its original state:

    • If the record is an insertion that fails on the server, it's removed from the DataSet as if it was never inserted.
    • If the record is a deletion that fails on the server, it's reinserted into the DataSet as if it was never deleted.
    • If the record is a modification that fails on the server, the modified fields are set back to their original values as if they were never modified.
  • Find Record: This option searches for the changed record within the DataSet and makes it the current record. You can then modify the record to fix the error that was reported from the server. (For example, if the server reports that it cannot insert a record with a null ID field, you can enter a valid value for the ID field.)

    After find the record, fix it, and close the dialog box, nothing will appear to happen but actually the changed record with your new modifications will be contained within the current DeltaPacket. The next time you click the Save button it will be sent back to the server.

Note: If you run the application online (hosted on the Macromedia site) you will not be able to save data to the server. Each time you attempt it you will receive an error. You must download the sample application and set it up on your own computer in order to save data to the Access database.